package com.coursehub.exercise.entity;

import jakarta.persistence.*;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

/**
 * 错题库题目关联实体类
 */
@Getter
@Setter
@NoArgsConstructor
@Entity
@Table(name = "wrong_question_bank_question")
public class WrongQuestionBankQuestion {
    
    @EmbeddedId
    private WrongQuestionBankQuestionId id;
    
    @MapsId("wrongQuestionBankId")
    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    @JoinColumn(name = "wrong_question_bank_id", nullable = false, insertable = false, updatable = false)
    private WrongQuestionBank wrongQuestionBank;
    
    @MapsId("questionId")
    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    @JoinColumn(name = "question_id", nullable = false, insertable = false, updatable = false)
    private Question question;
    
    public WrongQuestionBankQuestion(WrongQuestionBankQuestionId id, WrongQuestionBank wrongQuestionBank, Question question) {
        this.id = id;
        this.wrongQuestionBank = wrongQuestionBank;
        this.question = question;
    }
}